#ifndef __ETH_HAL_H__
#define __ETH_HAL_H__



#include <stm32f10x.h>
#include "netif.h"




#define 	DP83848_PHY
#define 	PHY_ADDRESS       				0x01


//#define MII_MODE
#define 	RMII_MODE


#define 	ETH_INIT_FLAG           		0x01 /* Ethernet Init Flag */
#define 	ETH_LINK_FLAG           		0x10 /* Ethernet Link Flag */



/* The DP83848 PHY status register  */
#define 	PHY_SPEED_STATUS       			((uint16_t)0x0002) /* PHY Speed mask */
#define 	PHY_DUPLEX_STATUS      			((uint16_t)0x0004) /* PHY Duplex mask */

/* The DP83848 PHY: MII Interrupt Control Register  */
#define 	PHY_MICR						0x11 /* MII Interrupt Control Register */
#define 	PHY_MICR_INT_EN           		((uint16_t)0x0002) /* PHY Enable interrupts */
#define 	PHY_MICR_INT_OE           		((uint16_t)0x0001) /* PHY Enable output interrupt events */

/* The DP83848 PHY: MII Interrupt Status and Misc. Control Register */
#define 	PHY_MISR                  		0x12 /* MII Interrupt Status and Misc. Control Register */
#define	 	PHY_MISR_LINK_INT_EN      		((uint16_t)0x0020) /* Enable Interrupt on change of link status */
#define 	PHY_LINK_STATUS           		((uint16_t)0x2000) /* PHY link status interrupt mask */



#define ETH_REG_WRITE_DELAY 				((uint32_t)0x00000001)



void Eth_HAL_Init(void);
uint32_t Eth_Link_PHYITConfig(uint16_t PHYAddress);
void Eth_Link_EXTIConfig(void);
void Eth_Link_ITHandler(uint16_t PHYAddress);
void ETH_link_callback(struct netif *netif);
	 




#endif /* __STM32F10F107_H */





/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/




